//package com.example.blog.controller;
//
//import com.example.blog.entity.User;
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.Cookie;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//
////登陆拦截器
//
//public class LoginActionInterceptor implements HandlerInterceptor {
//
//
//    @Override
//    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
//        User myinfo = (User) request.getSession().getAttribute("myinfo");
//        if (myinfo != null) {
//            Cookie cookie = new Cookie("uid",myinfo.getId().toString());
//            //有效期一周
//            cookie.setMaxAge(60 * 60 * 24 * 7);
//            response.addCookie(cookie);
//        }
//    }
//}
